<?php
$_preCats = array('200'=>'生活居家', '400'=>'趣味杂货', '300'=>'文具办公', '500'=>'个人用品');
$_uri = trim($_SERVER['REQUEST_URI']);
?>
<div id="left_track">
    <div id="left">
        <div id="leftcar" class="leftcar">
            <?php echo round_table('100%', '339933', 'white', 5, 5, 'top')?>
                <?php if($session['caramount']):?><a tabindex="100" href="<?php echo $_servername?>/shopcar/checkout"><?php endif?>
                <div id="icon_shopcar" class="sprites icon_shopcar_<?php echo $session['caramount'] ? 'full' : 'empty'?>"></div>
                <div style="position:absolute;left:50px;top:5px"><img id="car_eff" alt="" src="/images/blank.gif" /></div>
                <?php if($session['caramount']):?></a><?php endif?>
                <div id="cartext">您的购物车中<br />
                <?php if($session['caramount']):?>
                共有 <span id="caramount"><?php echo intval($session['caramount']);?></span> 件战利品
                <?php else:?>
                目前是空空的哦
                <?php endif?>
                </div>
                <div id="promo_div"><div <?php if(!$session['caramount']):?> style="display:none"<?php endif?> id="promo"><a href="<?php echo $_servername?>/shopcar/checkout">去结帐</a></div></div>
            <?php echo round_table('100%', '339933', 'white', 5, 5, 'bottom')?>
        </div>

        <div id="leftnav">
            <?php echo round_table('100%', '244890', 'white', 5, 5, 'top')?>
            <ul style="margin-top:10px">
                <li<?php if($_uri=='/whatnew') echo ' class="li-active"'?>><a tabindex="10" href="<?php echo $_servername?>/whatnew">&raquo; &nbsp; 新品上架</a></li>
                <li<?php if($_uri=='/whathot') echo ' class="li-active"'?>><a tabindex="10" href="<?php echo $_servername?>/whathot">&raquo; &nbsp; 热门物品</a></li>
                <?php foreach ($_preCats as $_k=>$_cat):
                ?>
                    <?php if($cats['parent']['id'] == $_k):?>
                        <li class="li-active"><a tabindex="10" href="<?php echo $_servername?>/itemslist/<?php echo $_k?>/">- &nbsp; <b><?php echo $_cat?></b></a>
                        <?php if(count($cats['list']) > 1)://只有一个子分类时不显示?>
                        <div class="subnav"><ul><?php foreach ($cats['list'] as $_subcat):?><li<?php if ($pid==$_subcat['id']) {echo " class='subnav-active'"; $_subCats=$_subcat;}?>><a tabindex="10" href="<?php echo $_servername?>/itemslist/<?php echo $_subcat['id']?>/">&#8250;&nbsp;<?php echo $_subcat['name'];?></a></li><?php endforeach?></ul></div>
                        <?php endif?>
                        </li>
                    <?php else:?>
                        <li><a tabindex="10" href="<?php echo $_servername?>/itemslist/<?php echo $_k?>/">+ &nbsp; <?php echo $_cat?></a></li>
                    <?php endif?>
                <?php endforeach?>
                <li<?php if($_uri=='/whatoffer') echo ' class="li-active"'?>><a tabindex="10" href="<?php echo $_servername?>/whatoffer">&raquo; &nbsp; 特价专区</a></li>
            </ul>

            <div style="text-align:center;margin: 20px auto"><a class="white px12" tabindex="10" href="<?php echo $_servername?>/cats">查看所有分类 &raquo;</a></div>
            <?php echo round_table('100%', '244890', 'white', 5, 5, 'bottom')?>
        </div>

        <?php require VIEWS.'nav_select.html'?>
    </div>
</div>

    <script type="text/javascript">Droppables.add('leftcar', {accept:'items', onDrop:function(element){showmsg=false;addtocar(element.id.replace(/^item/,''),false)}, hoverclass:'leftcart-active'});</script>
    <script type="text/javascript">//<![CDATA[
    var lh,bh,nh;
    var delta=0.15;
    var scroll_obj = (document.all ? window : document.documentElement);

    function scall(){
        var t = document.documentElement.scrollTop;

        $('left').style.display="";

        if (t<10) {
            $('left').style.top=t+"px";
            return;
        }

        if (t+lh<bh) {
            nh = t-40;
        } else {
            nh = bh-lh-105;
        }

        var llh = parseInt($('left').style.top);
        llh = llh ? llh : 0;

        if(llh != nh) {
            var dy = (nh-llh)*delta;
            dy = (dy>0?1:-1) * Math.ceil(Math.abs(dy));
            llh += dy; $('left').style.top = llh+"px";
        }
    }

    function scallLoad() {
        lh = $('left').scrollHeight;
        bh = document.documentElement.scrollHeight;
        window.setInterval('scall();',50);
    }
    <?php if($left_scroll==true):?>
    addDOMLoadEvent(scallLoad);
    <?php endif?>

//]]></script>
